﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ControlsLib.Gridview.Filtering
{
    public class SearchExtender
    {
        public event EventHandler AltFPressed;
        public event EventHandler CtrlFPressed;

        private Form m_form = null;

        public SearchExtender(Form form)
        {
            m_form = form;

            if (m_form != null)
            {
                m_form.KeyDown += new KeyEventHandler(KeyDownEvent);
            }
        }

        private void KeyDownEvent(object sender, KeyEventArgs e)
        {
            if ((e.KeyCode == Keys.F) && (e.Modifiers == Keys.Alt))
            {
                if (AltFPressed != null)
                {
                    AltFPressed(sender, e);
                }
            }
            else if ((e.KeyCode == Keys.F) && (e.Modifiers == Keys.Control))
            {
                if (CtrlFPressed != null)
                {
                    CtrlFPressed(sender, e);
                }
            }
        }
    }
}
